home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Example - test app for openurl.library
- ** Written by Troels Walsted Hansen <troels@thule.no>
- ** Placed in the public domain.
- **
- ** This is the one and only source file.
- */
-
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/openurl.h>
-
- #include <dos/dos.h>
- #include <libraries/openurl.h>
-
- static const char *version = "$VER: Example 1.2 " __AMIGADATE__;
- #define ARGS "URL,SHOW/S,TOFRONT/S,NEWWIN/S,LAUNCH/S,LAUNCHPREFS/S"
- enum { A_URL, A_SHOW, A_TOFRONT, A_NEWWIN, A_LAUNCH, A_LAUNCHPREFS, A_MAX };
- struct Library *OpenURLBase;
-
- int main(void)
- {
- int retval = RETURN_FAIL;
-
- if((OpenURLBase = OpenLibrary("openurl.library", 1)))
- {
- LONG args[A_MAX] = {0};
- struct RDArgs *rda;
-
- if((rda = ReadArgs(ARGS, args, NULL)))
- {
- if(args[A_LAUNCHPREFS])
- {
- if(OpenURLBase->lib_Version < 3)
- Printf("LAUNCHPREFS requires openurl.library V3+\n");
- else
- {
- URL_LaunchPrefsApp();
- retval = RETURN_OK;
- }
- }
- else if(args[A_URL])
- {
- if(URL_Open((STRPTR)args[A_URL], URL_Show, args[A_SHOW],
- URL_BringToFront, args[A_TOFRONT],
- URL_NewWindow, args[A_NEWWIN],
- URL_Launch, args[A_LAUNCH],
- TAG_DONE))
- retval = RETURN_OK;
- }
- else Printf("Either URL or LAUNCHPREFS must be specifed\n");
-
- FreeArgs(rda);
- }
- else PrintFault(IoErr(), "Failed to parse arguments");
-
- CloseLibrary(OpenURLBase);
- }
- else Printf("Requires openurl.library V1+\n");
-
- return(retval);
- }
-